<?php
/**
 * menueditor_main.inc
 * Template: Menu editor
 * @copyright	Copyright(c) 2002-2010 Bjorn Winberg
 * @author		Bjorn Winberg <cms@anomalye.net>
 * @license		http://www.gnu.org/licenses/gpl.html GNU General Public License version 2
 */
	$this->mSystem->mHtmlHeaders[] = '<link type="text/css" href="' . $this->getSkinUrl('menueditor_main.css') . '" rel="stylesheet" />';
?>
<h1><?php echo $this->localString('M_TITLE');?></h1>
<?php
	echo $this->generateMenu('menueditor', 'MENUES', 'subMenu');
?>
<div class="helpBox">
	<?php echo $this->localString('M_HELP');?>
</div>

<?php
	//echo $aParams['module'] . ':' . $aParams['menu'];
	echo '<div class="sectionHeader">';
	echo '<div class="menueditorUpdateCol menueditorUpdateColInsert">&nbsp;</div>';
	echo '<div class="menueditorUpdateCol menueditorUpdateColLable">' . $this->localString('M_LABEL') . '</div>';
	echo '<div class="menueditorUpdateCol menueditorUpdateColLink">' . $this->localString('M_LINK') . '</div>';
	echo '<div class="menueditorUpdateCol menueditorUpdateColAuth">' . $this->localString('M_AUTH') . '</div>';
	echo '</div>';
	if($aParams['menuItem'] !== false){
		echo '<form id="menueditor_addMenuForm" action="' . $this->generateUrl('menueditor', array('module' => $aParams['module'], 'menu' => $aParams['menu'], 'a' => 'update')) . '" method="post">';
		foreach($aParams['menuItem'] as $rowId => $rowItem){
			echo '<div class="sectionRow1">';
			echo '<div class="menueditorUpdateCol menueditorUpdateColInsert"><input type="submit" name="insert:' . $rowId . '" value="' . $this->localString('M_ADD') . '" /></div>';
			echo '<div class="menueditorUpdateCol menueditorUpdateColLable"><input type="text" name="label:' . $rowId . '" value="' . $this->getSafeStr($aParams['menuItem'][$rowId]['label']) . '" maxlength="' . MenuEditor::PARAM_MAX_LABEL . '" />' . '</div>';
			echo '<div class="menueditorUpdateCol menueditorUpdateColLink"><input type="text" name="url:' . $rowId . '" value="' . $this->getSafeStr($aParams['menuItem'][$rowId]['url']) . '" maxlength="' . MenuEditor::PARAM_MAX_URL . '" />' . '</div>';
			echo '<div class="menueditorUpdateCol menueditorUpdateColAuth"><input type="text" name="auth:' . $rowId . '" value="' . $this->getSafeStr($aParams['menuItem'][$rowId]['visibility']) . '" maxlength="' . MenuEditor::PARAM_MAX_VISIBILITY . '" />' . '</div>';
			echo '<div class="menueditorUpdateCol menueditorUpdateColDelete"><input type="submit" name="delete:' . $rowId . '" value="' . $this->localString('M_DELETE') . '" /></div>';
			echo '</div>';
		}
		echo '<div class="sectionRow1">';
		echo '<div class="menueditorUpdateCol menueditorUpdateColInsert"><input type="submit" name="insert:' . count($aParams['menuItem']) . '" value="' . $this->localString('M_ADD') . '" /></div>';
		echo '<div class="menueditorUpdateCol menueditorUpdateColSave"><input type="submit" name="update:0" value="' . $this->localString('M_UPDATE') . '" /></div>';
		echo '</div>';
		echo '</form>';
	}
?>

<form class="simpleForm" id="menueditor_createMenuForm" action="<?php echo $this->generateUrl('menueditor', array('a' => 'create'));?>" method='post'>
	<fieldset>
	<legend><?php echo $this->localString('M_CREATE_LABEL');?></legend>
	<div class="simpleRequired">
		<label for="module"><?php echo $this->localString('M_CREATE_MODULE');?></label>
		<input type='text' name='module' id='module' value="" maxlength="<?php echo MenuEditor::PARAM_MAX_MODULE;?>" />
		<label for="menu"><?php echo $this->localString('M_CREATE_NAME');?></label>
		<input type='text' name='menu' id='menu' value="" maxlength="<?php echo MenuEditor::PARAM_MAX_MENU;?>" />
	</div>
	<input type='submit' name='submit' value="<?php echo $this->localString('M_CREATE_SUBMIT');?>" />
	</fieldset>
</form>
